package com.qf.spring.service.advices;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * @author 王博康
 * @version 1.0
 * @project 03_spring
 * @description: TODO
 * @date 2022/3/6 23:10 星期日
 */
public class MyAroundAdvice implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        System.err.println("123");
        Object proceed = null;
        try {
            proceed = methodInvocation.proceed();
            System.err.println("456");
        } catch (Throwable throwable) {
            System.err.println("回滚事务");
            throwable.printStackTrace();
        }
        return proceed;
    }
}
